package org.xq.shop.maxaishop.service.impl;

import org.springframework.stereotype.Service;
import org.xq.shop.maxaishop.dao.XqCustomerDao;
import org.xq.shop.maxaishop.entity.XqCustomer;
import org.xq.shop.maxaishop.vo.XqCustomerVo;
import org.xq.shop.maxaishop.service.XqCustomerService;

import javax.annotation.Resource;
import java.util.List;

/**
 * (XqCustomer)表服务实现类
 *
 * @author makejava
 * @since 2021-06-10 18:01:36
 */
@Service("xqCustomerService")
public class XqCustomerServiceImpl implements XqCustomerService {
    @Resource
    private XqCustomerDao xqCustomerDao;

    /**
     * 通过ID查询单条数据
     *
     * @param customerId 主键
     * @return 实例对象
     */
    @Override
    public XqCustomer queryById(Long customerId) {
        System.out.println("customerId == " + customerId);
        return this.xqCustomerDao.queryById(customerId);
    }

    @Override
    public XqCustomer queryByNameAndPwd(String name, String pwd) {
        return this.xqCustomerDao.queryByNameAndPwd(name , pwd);
    }

    @Override
    public int registered(XqCustomer xqCustomer) {
        return this.xqCustomerDao.registered(xqCustomer);
    }

    @Override
    public int countt(String uname) {
        return this.xqCustomerDao.countt(uname);
    }

    @Override
    public int reset(String uname, String tel) {
        return this.xqCustomerDao.reset(uname,tel);
    }

    @Override
    public XqCustomer selectByUnameAndTel(String uname, String tel) {
        return this.xqCustomerDao.selectByUnameAndTel(uname,tel);
    }

    @Override
    public List<XqCustomerVo> selectAll(Integer start, Integer end) {
        return this.xqCustomerDao.selectAll(start,end);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<XqCustomer> queryAllByLimit(int offset, int limit) {
        return this.xqCustomerDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param xqCustomer 实例对象
     * @return 实例对象
     */
    @Override
    public XqCustomer insert(XqCustomer xqCustomer) {
        this.xqCustomerDao.insert(xqCustomer);
        return xqCustomer;
    }

    @Override
    public int updatePwd(XqCustomer xqCustomer) {
        return this.xqCustomerDao.updatePwd(xqCustomer);
    }

    /**
     * 修改数据
     *
     * @param xqCustomer 实例对象
     * @return 实例对象
     */
    @Override
    public int update(XqCustomer xqCustomer) {
       return this.xqCustomerDao.update(xqCustomer);
    }

    @Override
    public XqCustomer selectByname(String uname) {
        return this.xqCustomerDao.selectByname(uname);
    }

    /**
     * 通过主键删除数据
     *
     * @param customerId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long customerId) {
        return this.xqCustomerDao.deleteById(customerId) > 0;
    }

    @Override
    public int selectCount() {
        return this.xqCustomerDao.selectCount();
    }

    @Override
    public List<XqCustomerVo> selectByUname(String uname,Integer start,Integer end) {
        return this.xqCustomerDao.selectByUname(uname,start,end);
    }
}
